package com.wu.leetcode.leetcode392;

/**
 * Leetcode392392-判断子序列
 *
 * @author lynn
 * @date 2020/8/10 - 23:05
 */
class Solution {
    public static boolean isSubsequence(String s, String t) {
        int n = s.length(), m = t.length();
        int i = 0, j = 0;
        while (i < n && j < m) {
            if (s.charAt(i) == t.charAt(j)) {
                i++;
            }
            j++;
        }
        return i == n;
    }

    public static void main(String[] args) {
        boolean subsequence = isSubsequence("abc", "ahbgdc");
        System.out.println(subsequence);
    }
}